package util.time
{
	public class TimeUtil
	{
		public static function formatTimeValue(v:Number): String {
			return v<10 ? "0"+v : ""+v;
		}
		
		public static function formatTime(t:Date): String {
			return formatTimeValue(t.hours) + ":" + formatTimeValue(t.minutes) + ":" + formatTimeValue(t.seconds);
		}
		
		public static function formatSeconds(v:Number): String {
			var hours:Number = v < 3600 ? 0 : Math.floor(v / 3600);
			var minutes:Number = v < 60 ? 0 : Math.floor(v / 60);
			var seconds:Number = v % 60;
			return formatTimeValue(hours) + ":" + formatTimeValue(minutes) + ":" + formatTimeValue(seconds);
		}

	}
}